<template>
  <div>
    <div>
      <el-button type="primary" size="small" >文件类型不可新增</el-button>
      <el-table :data="application" style="width: 100%">
        <el-table-column prop="id" label="id" width="180">
        </el-table-column>
        <el-table-column prop="fileName" label="农作物名字名字" width="180">
        </el-table-column>
        <el-table-column prop="groupName" label="团队名字" width="180">
        </el-table-column>
        <el-table-column prop="uploadTime" label="上载时间" width="180">
        </el-table-column>
        <el-table-column prop="extName" label="ext_name" width="180">
        </el-table-column>
        <el-table-column prop="fileSize" label="文件大小" width="180">
        </el-table-column>
        <el-table-column prop="fileType" label="文件类型"> </el-table-column>
          <!-- 操作列 -->
        <el-table-column width="100" align="center" label="操作">
          <template slot-scope="scope">
            <el-button type="text" @click="editHandler(scope.row)">修改</el-button>
            <el-button type="text" @click="deleteHandler(scope.row)">删除</el-button>
          </template>
        </el-table-column>
      </el-table>
    </div>
  </div>
</template>

<script>
import { del,get } from "@/utils/request";
export default {
  data() {
    return {
      application: [],
      visible: false
    };
  },
  methods: {
       // 删除的处理函数
    deleteHandler(row){
      this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        let url = "http://120.77.41.127:8888/baseFile/deleteById"
        del(url,{id:row.id}).then(resp =>{
          // 1. 提示
          this.$message({type:"success",message:resp.message});
          // 2. 刷新
          this.loadApplication();
        })
      })
    },
    // 修改的处理函数
    editHandler(row){
      this.$router.push({ 
        path:"/lhm/BaseFile_Form" ,
        query:row
      })
    },

    // 跳转到温室大棚录入页面
    toFormHandler() {
      // 跳转
      this.$router.push({ path: "/lhm/BaseFile_Form" });
    },
    loadApplication() {
      let url = "http://120.77.41.127:8888/baseFile/query";
      get(url).then(resp => {
        this.application = resp.data;
      });
    }
  },
  created() {
    this.loadApplication();
  }
};
</script>

<style lang="sass" scoped>

</style>
